package com.ssm.service;


import com.ssm.Entity.User;

import com.ssm.dao.UserDAOImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service

public class UserService {

    @Autowired
     private UserDAOImpl userDAO;


    public UserDAOImpl getUserDAO() {
        return userDAO;
    }

    public void setUserDAO(UserDAOImpl userDAO) {
        this.userDAO = userDAO;
    }

    public UserService() {
    }

    @Transactional
    public List<User> selectAllUser(int currentPage,int pageSize){
        return  userDAO.selectUser((currentPage-1)*pageSize,pageSize);
    }


    public int addUser(User user) { return userDAO.addUser(user); }

    public int userLogin(User user) { return userDAO.userLogin(user); }

    public User findUserById(int userId) {
        return userDAO.findUserById(userId);
    }

    public int getTotal() {
        return userDAO.getTotal();
    }
}
